package us.wili.dev.client.service.impl;

import org.springframework.stereotype.Service;
import us.wili.dev.client.dao.ClientActivityMapper;
import us.wili.dev.client.model.rsp.ActivityRsp;
import us.wili.dev.client.service.ClientActivityService;
import us.wili.dev.model.entity.Activity;
import us.wili.dev.model.example.ActivityExample;
import us.wili.dev.service.impl.BaseActivityServiceImpl;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Service
public class ClientActivityServiceImpl extends BaseActivityServiceImpl implements ClientActivityService {
    @Resource
    private ClientActivityMapper clientAddressMapper;

    @Override
    public List<ActivityRsp> Activity() {
        List<Activity> list = searAbstract();
        List<ActivityRsp> rsp = new ArrayList<>();
        for (Activity activity : list) {
            ActivityRsp rsp1 = ActivityRsp.ToActivity(activity);
            rsp.add(rsp1);
        }
        return rsp;
    }

    public List<Activity> searAbstract(){
        ActivityExample example = new ActivityExample();
        example.createCriteria();
        return clientAddressMapper.selectByExample(example);
    }

}
